package yxy.game.pm2.module.union.rank;

import org.redisson.api.RScoredSortedSet;
import yxy.game.pm2.bean.ServerBean;
import yxy.game.pm2.bean.area.AreaBean;
import yxy.game.pm2.bean.area.AreaGroupBean;
import yxy.game.pm2.bean.module.rank.PlayerRankModule;

/** 按战区内排行：有活跃表现的联盟排名 */
public class RankAreaGroupActiveUnion extends UnionAreaGroupRankModule {

	public RankAreaGroupActiveUnion(AreaGroupBean areaGroupBean) {
		super(areaGroupBean);
	}

	@Override
	public String rankName() {
		return PlayerRankModule.getAllRankNames().get(15);
	}

	@Override
	protected boolean reconsitution() {
		return false;
	}

	@Override
	protected long valuePlastic(long value) {
		return value;
	}

	@Override
	protected long valueRestore(long score) {
		return score;
	}

	@Override
	protected void addScore(String unionCode, long value) {
		RScoredSortedSet<String> zset = touch();
		zset.add(value, unionCode);
	}

	static public RankAreaGroupActiveUnion get(int areaGroupId) {
		AreaGroupBean areaGroupBean = AreaGroupBean.get(areaGroupId);
		if (areaGroupBean == null) {
			return null;
		}
		return new RankAreaGroupActiveUnion(areaGroupBean);
	}
}
